package com.wnxy.exception;

import org.apache.ibatis.util.MapUtil;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * 全局异常
 */
@RestControllerAdvice
public class GlobalException {

    /**
     * 处理Exception类型的异常
     */
    @ExceptionHandler(Exception.class)
    public Map handlerException(Exception e) {
        Map map = new HashMap();
        map.put("code","500");
        map.put("message",e.getMessage());
        return map;
    }
}
